# -*- coding: utf-8 -*-
"""
@Time : 2024/3/6 9:54 PM
@Author: imamhusan
@Des: 描述
"""
import socket

udp_socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)

udp_socket.bind(('192.168.1.156', 1133))

print('UPD 服务已启动.....')

while True:
    # 接收数据
    data, addr = udp_socket.recvfrom(1024)
    print(f'来自于：{addr} 信息内容：{data.decode()}')

    if data == 'q':
        udp_socket.close()
        break

    # 回复信息
    send_msg = input('请输入回复内容：')
    udp_socket.sendto(send_msg.encode(), addr)




